//
//  OMOrderAddressTableCell.m
//  OMENGO
//
//  Created by 梁尚嘉 on 2017/3/9.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMOrderAddressTableCell.h"
#import "OMOrderDetailAppearace.h"

#import "OMOrder.h"
@implementation OMOrderAddressTableCell

- (void)configureCellWithObj:(OMOrder *)order
{
    _nameLabel.text = order.consignee;
    _phoneLabel.text = [order.phone isMobile] ? order.phone : ({
        NSString *midStr = [order.phone substringWithRange:NSMakeRange(4, 4)];
        [order.phone stringByReplacingOccurrencesOfString:midStr withString:@"****"];
    });
    _addressLabel.text = [order.areaName stringByAppendingString:order.address];
}

- (void)configure
{
    [super configure];

    _nameLabel = [UILabel new];
    _nameLabel.font = OMODA_Font;
    _nameLabel.textColor = SM_blackColor;
    [self.contentView addSubview:_nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OMODA_INSETS.left));
        make.top.equalTo(@(OMODA_INSETS.top));
    }];


    _phoneLabel = [UILabel new];
    _phoneLabel.font = OMODA_Font;
    _phoneLabel.textColor = SM_blackColor;
    [self.contentView addSubview:_phoneLabel];
    [_phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLabel.mas_right).offset(SM_SIZE(50));
        make.centerY.equalTo(self.nameLabel.mas_centerY);
    }];


    _addressLabel = [UILabel new];
    _addressLabel.font = SM_CFont(26);
    _addressLabel.textColor = HEXCOLOR(@"#AAAAAA");
    _addressLabel.numberOfLines = 1;
    [self.contentView addSubview:_addressLabel];
    [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.mas_left);
        make.top.equalTo(_nameLabel.mas_bottom).offset(SM_SIZE(14));
        make.right.equalTo(@(-OMODA_INSETS.right));
    }];
}



+ (CGFloat)cellHeight
{
    return SM_SIZE(150);
}
@end
